#include <cstdio>
using ll = long long;

const int N = 1e5 + 5, bit = 17;
int n, m;
int f[bit][N], lg[N];

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#else
  freopen("External.in", "r", stdin);
  freopen("External.out", "w", stdout);
#endif
#endif

  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &f[0][i]);
  lg[0] = -1;
  for (int i = 1; i <= n; ++i) lg[i] = lg[i >> 1] + 1;
  for (int i = 1; i < bit; ++i)
    for (int j = 1; j <= n; ++j)
      f[i][j] = f[i - 1][j + (1 << (i - 1))] | f[i - 1][j];
  ll ans = 0;
  for (int i = 1; i <= n; ++i) {
    int l = 1, r = i, mid, s, k;
    while (l < r) {
      mid = (l + r) >> 1;
      s = lg[i - mid + 1];
      k = f[s][mid] | f[s][i - (1 << s) + 1];
      if (k <= m) r = mid;
      else
        l = mid + 1;
    }
    ans += i - r;
  }
  printf("%lld", ans);
  return 0;
}